/**
 * ClientType.java 
 * Copyright © 2015-3015, 杭州泊享网络科技有限公司
 * 
 * @author Liu Tao
 * @create 2013年8月25日
 */
package com.pshare.enums;


/**
 * 操作类型
 */
public enum ActionType {
	
	QUERY(0, "QUERY"), ADD(1, "ADD"), UPDATE(2, "UPDATE"), DELETE(3, "DELETE");

	private Integer code;
	private String name;

	private ActionType(Integer code, String name) {
		this.code = code;
		this.name = name;
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public static String getName(Integer code) {
		if (code == null) {
			return "";
		}
		for (ActionType commonEnum : ActionType.values()) {
			if (commonEnum.getCode() == code) {
				return commonEnum.getName();
			}
		}
		return "";
	}
}
